﻿using StudySystem.MainLogic.FormControl;
using StudySystem.MainLogic.Items;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace StudySystem.Windows
{
    public partial class FormSelectedQues : Form
    {
        List<ClassQuestion> questions;
        public FormSelectedQues()
        {
            InitializeComponent();

        }
        public FormSelectedQues(List<ClassQuestion> questions)
        {
            InitializeComponent();
            this.questions = questions;
        }

        private void FormSelectedQues_Load(object sender, EventArgs e)
        {
            FormQuesControl.ShowQuestions(flpQuestions, questions);
            foreach (Question q in this.flpQuestions.Controls)
            {
                FormController.TxtShowControl(AnswerState.Hide, q.richTxtAnswer, q.Ques.Answer);
            }
        }

        private void btnSubmitRecord_Click(object sender, EventArgs e)
        {
            FormQuesControl.SubmitRecords(this.flpQuestions);
            MessageBox.Show("已提交所有答题记录！");
        }

        private void btnShowQues_Click(object sender, EventArgs e)
        {
            foreach (Question q in this.flpQuestions.Controls)
            {
                FormController.TxtShowControl(AnswerState.Show, q.richTxtAnswer, q.Ques.Answer);
            }
        }

        private void btnHideQues_Click(object sender, EventArgs e)
        {
            foreach (Question q in this.flpQuestions.Controls)
            {
                FormController.TxtShowControl(AnswerState.Hide, q.richTxtAnswer, q.Ques.Answer);
            }
        }
    }
}
